<template>
  <div class="page">

    <div class="line_cell">
      <span>单个顾问星标客户名单最多可添加</span>
      <el-input v-model="addForm.consultantMaxStarCustomerCnt" class="a_input" size="small"></el-input>
      <span>个</span>
    </div>

    <div class="line_cell">
      <span>单个顾问单日最多可从公海认领客户</span>
      <el-input v-model="addForm.consultantMaxClaimCustomerCnt" class="a_input" size="small"></el-input>
      <span>个</span>
    </div>

    <div class="line_cell">
      <span>到店收款时间填写必须在</span>
      <el-input v-model="addForm.arrivedDealLimitDays" class="a_input" size="small"></el-input>
      <span>天内</span>
    </div>

    <div class="line_cell">
      <span>可承接未成交客户量配置</span>
      <el-input v-model="addForm.ableHandleUndealCustomerCnt" class="a_input" size="small"></el-input>
      <span></span>
    </div>

    <!-- 待预约客户跟进规则 开始 -->
    <div class="line_box" v-if="false">
      <span class="name">待预约客户跟进规则：</span>
      <div class="cell_list">
        <div class="line_cell">
          <span>第2次跟进与第1次跟进间隔不得超过</span>
          <el-input v-model="addForm.waitingIntervalDayCnt1" class="a_input" size="small"></el-input>
          <span>天</span>
        </div>
        <div class="line_cell">
          <span>第3次跟进与第1次跟进间隔不得超过</span>
          <el-input v-model="addForm.waitingIntervalDayCnt2" class="a_input" size="small"></el-input>
          <span>天</span>
        </div>
        <div class="line_cell">
          <span>第4次跟进与第1次跟进间隔不得超过</span>
          <el-input v-model="addForm.waitingIntervalDayCnt3" class="a_input" size="small"></el-input>
          <span>天</span>
        </div>
        <div class="line_cell">
          <span>第5次跟进与第1次跟进间隔不得超过</span>
          <el-input v-model="addForm.waitingIntervalDayCnt4" class="a_input" size="small"></el-input>
          <span>天</span>
        </div>
        <div class="line_cell">
          <span>第6次跟进与第1次跟进间隔不得超过</span>
          <el-input v-model="addForm.waitingIntervalDayCnt5" class="a_input" size="small"></el-input>
          <span>天</span>
        </div>
        <div class="line_cell">
          <span>第7次跟进与第1次跟进间隔不得超过</span>
          <el-input v-model="addForm.waitingIntervalDayCnt6" class="a_input" size="small"></el-input>
          <span>天</span>
        </div>
      </div>
    </div>
    <!-- 待预约客户跟进规则 end -->

    <!-- 未成交客户跟进规则 开始 -->
    <div class="line_box" v-if="false">
      <span class="name">未成交客户跟进规则：</span>
      <div class="cell_list">
        <div class="line_cell">
          <span>第1次跟进与标记成为未成交后的间隔不超过</span>
          <el-input v-model="addForm.undealIntervalDayCnt1" class="a_input" size="small"></el-input>
          <span>天</span>
        </div>
        <div class="line_cell">
          <span>第2次跟进与标记成为未成交后的间隔不超过</span>
          <el-input v-model="addForm.undealIntervalDayCnt2" class="a_input" size="small"></el-input>
          <span>天</span>
        </div>
        <div class="line_cell">
          <span>第3次跟进与标记成为未成交后的间隔不超过</span>
          <el-input v-model="addForm.undealIntervalDayCnt3" class="a_input" size="small"></el-input>
          <span>天</span>
        </div>
        <div class="line_cell">
          <span>第4次跟进与标记成为未成交后的间隔不超过</span>
          <el-input v-model="addForm.undealIntervalDayCnt4" class="a_input" size="small"></el-input>
          <span>天</span>
        </div>
      </div>
    </div>
    <!-- 未成交客户跟进规则 end -->

    <div class="btn_group">
      <el-button type="primary" :loading="loading" @click="saveInfo()">保存</el-button>
    </div>

  </div>
</template>
<script>
import { GETFOLLOWRULES, SAVEFOLLOWRULES } from "@/http/system";
import { showToast, deepClone } from "@/common/util";
export default {
  data() {
    return {
      addForm: {},
      loading: false,
    };
  },
  mounted() {
    this.getRules();
  },
  methods: {
    // 获取配置规则
    getRules() {
      GETFOLLOWRULES().then((res) => {
        this.addForm = res.data || {};
      });
    },

    // 保存配置规则
    saveInfo() {
      let oParams = deepClone(this.addForm);
      this.loading = true;
      SAVEFOLLOWRULES(oParams)
        .then((res) => {
          this.loading = false;
          if (res.code == 200) {
            showToast({
              message: "保存成功",
              type: "success",
            });
          }
        })
        .catch((error) => {
          this.loading = false;
        });
    },
  },
};
</script>
<style lang="scss" scoped>
.page {
  background: #fff;
  border-radius: 4px;
  padding: 10px;
  font-family: PingFang SC-Medium, PingFang SC;
  font-size: 14px;
  font-weight: 500;
  color: #999;
}
.line_cell {
  display: flex;
  align-items: center;
  margin: 10px 0;
  font-size: 14px;
  .a_input {
    width: 120px;
    margin: 0 10px;
  }
}
.line_box {
  display: flex;
  margin-top: 30px;
  .name {
    font-size: 14px;
    color: #999;
    width: 150px;
  }
  .cell_list {
    padding-top: 10px;
  }
}
.btn_group {
  padding: 20px 0 0 150px;
}
</style>